package home_4_8;

public class Caishuzi {
    private  int zhun;
    private int  cai=(int)(Math.random()*10)+2;




    public int getZhun() {
        return zhun;
    }

    public void setZhun(int zhun) {
        this.zhun = zhun;
    }


   void pan()
   {
       int count=1;
  while (cai!=zhun)

  {

      if (cai < zhun) {
          System.out.println("你猜的数字是" + cai);
          System.out.println("你猜小了");

      }

      else if (cai > zhun) {
          System.out.println("你猜的数字是" + cai);
          System.out.println("猜大了");

      }
      count=count+1;


          System.out.println("猜对了");
          System.out.println("你猜的数字是" + cai);







      System.out.println("你猜了"+count+"次");
      break;
  }
   }

}
